
// 存取获取经纬度
import jweixin from '@/components/jweixin-module/jsdk'
import wechat from '@/components/jweixin-module/wechat'
var QQMapWX = require('@/components/jweixin-module/jssdk.js');
var qqmapsdk;
export default {
  data() {
    return {
		latitude: '', //纬度
		longitude: '', //经度
    }
  },
  onLoad(){
	wechat.scanQRJssdk()
	qqmapsdk = new QQMapWX({
		key: 'VXOBZ-MNYL4-UXRUV-XVTEP-IE2OS-NTBUW', //腾讯地图key
		vm: this
	});
	setTimeout(() => {
	   this.getLocation()
	}, 500)
  },
  methods: {
	getLocation() {
		let that = this
		jweixin.getLocation({
			type: 'gcj02', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
			success: function(res) {
				that.latitude = res.latitude
				that.longitude = res.longitude
			},
			cancel: function() {
				console.log(5454)
			},
			fail: function(res) {
				console.log(666)
				// uni.showToast({
				// 	title: '定位失败，请重新定位',
				// 	icon: 'none'
				// })
			},
		});
	},
  }
}
